package com.hongyuan.sellfitness.ui.person.view_mode;

import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.databinding.ObservableField;
import com.hongyuan.mvvmhabitx.binding.command.BindingAction;
import com.hongyuan.mvvmhabitx.binding.command.BindingCommand;
import com.hongyuan.sellfitness.base.Constants;
import com.hongyuan.sellfitness.base.ItemViewModel;
import com.hongyuan.sellfitness.ui.person.activity.CancelReservationActivity;
import com.hongyuan.sellfitness.ui.person.beans.MyReservationBean;

public class MyReservationItemViewModel extends ItemViewModel<MyReservationViewModel> {

    public ObservableField<MyReservationBean.ListBean> entity = new ObservableField<>();

    public MyReservationItemViewModel(@NonNull MyReservationViewModel viewModel, MyReservationBean.ListBean bean) {
        super(viewModel);
        entity.set(bean);
    }

    //签到
    public BindingCommand qdCourse = new BindingCommand(new BindingAction() {
        @Override
        public void call() {
            viewModel.itemClick(MyReservationItemViewModel.this);
            viewModel.setParams("cpa_id",String.valueOf(entity.get().getCpa_id())).setParams("mtype","xy").setParams("type","qd");
            viewModel.requestData(Constants.PRIVITE_COURSE_QD);
        }
    });

    //取消课程
    public BindingCommand cancelCourse = new BindingCommand(new BindingAction() {
        @Override
        public void call() {
            Bundle bundle = new Bundle();
            bundle.putString("cpa_id",String.valueOf(entity.get().getCpa_id()));
            bundle.putString("tel",entity.get().getJl_mobile());
            viewModel.startActivity(CancelReservationActivity.class,bundle);
        }
    });
}
